import java.util.Scanner;

public class DIVSUM {
	public static void main(String args[]) {
		Scanner in = new Scanner(System.in);

		// Enter number of testcases
		int testcases = in.nextInt();
		while (testcases-- > 0) {
			int number = in.nextInt();
			System.out.println(divisorSum(number));
		}
	}
	private static int divisorSum(int number) {
		int numberSqrt = (int) Math.sqrt(number);
		int sum = 1;
		int temp = 0;
		for (int i = 2; i <= numberSqrt; i++) {
			if ((number % i) == 0) {
				sum += i;
				temp = (number / i);
				if (((number % temp) == 0) && (temp < number)) {
					sum += temp;
				}
			}

		}
		return sum;
	}
}
